/**
 * @author gabriele.cerfoglio@usi.ch
 */

package ch.usi.inf.pf2;

import java.io.FileNotFoundException;
import java.io.ObjectOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileSaver {
	public static void save(String filename, Object object) {
		// Creating the output streams for object and file
		FileOutputStream fileOut = null;
		ObjectOutputStream objectOut = null;
		try {
			fileOut = new FileOutputStream(filename);
			objectOut = new ObjectOutputStream(fileOut);

			objectOut.writeObject(object);
			objectOut.close();

		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		// Writing the object to a file
	}
}
